
<%@ page import="org.tailor.Comment" %>
<html>
  <head>
  <g:javascript library="prototype" />
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="layout" content="main" />
  <g:set var="entityName" value="${message(code: 'comment.label', default: 'Comment')}" />
  <title><g:message code="default.list.label" args="[entityName]" /></title>
</head>
<body>
  <div class="nav">
    <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
    <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
  </div>
  <div class="body">
    <h1><g:message code="default.list.label" args="[entityName]" /></h1>
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <div class="list">
      <table>
        <thead>
          <tr>
        <g:sortableColumn property="commentDate" title="${message(code: 'comment.commentDate.label', default: 'Comment Date')}" />               
        <th><g:message code="comment.clientIdClient.label" default="Client Id Client" /></th>
        <th><g:message code="comment.regionIdRegions.label" default="Region Id Regions" /></th>        
        <g:sortableColumn property="description" title="${message(code: 'comment.description.label', default: 'Description')}" />
        <g:sortableColumn property="id" title="${message(code: 'comment.action.label', default: 'Action')}" />

        </tr>
        </thead>
        <tbody>
        <g:each in="${commentInstanceList}" status="i" var="commentInstance">
          <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
            <td><g:link action="show" id="${commentInstance.id}"><g:formatDate date="${commentInstance.commentDate}"  format= "MMM/dd/yyyy HH:MM:SS"/></g:link></td>         

          <td>${fieldValue(bean: commentInstance, field: "clientIdClient")}</td>
          <td>${fieldValue(bean: commentInstance, field: "regionIdRegions")}</td>         
          <td>${fieldValue(bean: commentInstance, field: "description")}</td>
          <td style="text-align: center">
          <g:if test="${commentInstance.commentApproved}">
            <g:link action="change" id='${fieldValue(bean: commentInstance, field: "id")}'  
                    onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">
              <img src="${resource(dir:'images/action',file:'deny.png')}" 
                   height="15px" width="15px"
                   alt="${message(code:'spinner.alt',default:'deactive')}" />
            </g:link>
          </g:if>
          <g:else>
            <g:link action="change" id='${fieldValue(bean: commentInstance, field: "id")}'  
                    onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">
              <img src="${resource(dir:'images/action',file:'accept.png')}"
                   height="15px" width="15px"
                   alt="${message(code:'spinner.alt',default:'active')}" />
            </g:link>
          </g:else>&nbsp;
          <g:link action="delete" id='${fieldValue(bean: commentInstance, field: "id")}'  
                  onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">
            <img src="${resource(dir:'images/action',file:'del.png')}"
                 height="15px" width="15px"
                 alt="${message(code:'spinner.alt',default:'del')}"                
                 />
          </g:link >    
          </td>       


          </tr>
        </g:each>
        </tbody>
      </table>
    </div>
    <div class="paginateButtons">
      <g:paginate total="${commentInstanceTotal}" />
    </div>
  </div>
</body>
</html>
